import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:life_service/color/hex.dart';
import 'package:life_service/extensions/ex_widget.dart';
import 'package:life_service/route/index.dart';
import 'package:life_service/ui/draw_under_line.dart';
import 'package:life_service/utils/styles.dart';

class HomeMessageController extends GetxController {}

class HomeMessageView extends GetView<HomeMessageController> {
  const HomeMessageView({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        backgroundColor: Colors.white,
        leading: Text(
          '消息',
          style: StylesUtils.customTextStyle(
            color: HexColor.color3333,
            fontSize: StylesUtils.fontSize18,
            fontWeight: FontWeight.w700,
          ),
        ).center(),
        elevation: 1,
        shadowColor: HexColor(HexColor.colorF2f2),
        systemOverlayStyle: SystemUiOverlayStyle.dark,
      ),
      body: SingleChildScrollView(
        padding: const EdgeInsets.only(left: 20),
        child: Column(
          children: [
            DrawUnderLine(
              child: Padding(
                padding: const EdgeInsets.only(right: 20),
                child: SizedBox(
                  height: 66,
                  child: Row(
                    children: [
                      CircleAvatar(
                        radius: 24,
                        backgroundColor: HexColor('#00CC99'),
                        child: const Icon(
                          CupertinoIcons.at_circle_fill,
                          size: 25,
                          color: Colors.white,
                        ),
                      ),
                      Expanded(
                        child: Padding(
                          padding: const EdgeInsets.only(left: 15),
                          child: Column(
                            children: [
                              Container(
                                margin: const EdgeInsets.only(top: 15),
                                alignment: Alignment.centerLeft,
                                child: Row(
                                  mainAxisAlignment:
                                      MainAxisAlignment.spaceBetween,
                                  children: [
                                    Text(
                                      '订单通知',
                                      style: StylesUtils.customTextStyle(
                                        color: HexColor.color3333,
                                        fontWeight: FontWeight.w700,
                                      ),
                                    ),
                                    Text(
                                      '2024-10-12',
                                      style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize12,
                                        color: HexColor.colorCccc,
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                              Container(
                                margin: const EdgeInsets.only(top: 10),
                                alignment: Alignment.centerLeft,
                                child: Text(
                                  '退款最新进度',
                                  style: StylesUtils.customTextStyle(
                                    fontSize: StylesUtils.fontSize12,
                                    color: HexColor.colorCccc,
                                  ),
                                ),
                              )
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ),
            DrawUnderLine(
              child: Padding(
                padding: const EdgeInsets.only(right: 20),
                child: SizedBox(
                  height: 66,
                  child: Row(
                    children: [
                      CircleAvatar(
                        radius: 24,
                        backgroundColor: HexColor(HexColor.colorFfc7),
                        child: const Icon(
                          CupertinoIcons.bell_fill,
                          size: 25,
                          color: Colors.white,
                        ),
                      ),
                      Expanded(
                        child: Padding(
                          padding: const EdgeInsets.only(left: 15),
                          child: Column(
                            children: [
                              Container(
                                margin: const EdgeInsets.only(top: 15),
                                alignment: Alignment.centerLeft,
                                child: Row(
                                  mainAxisAlignment:
                                      MainAxisAlignment.spaceBetween,
                                  children: [
                                    Text(
                                      '服务通知',
                                      style: StylesUtils.customTextStyle(
                                        color: HexColor.color3333,
                                        fontWeight: FontWeight.w700,
                                      ),
                                    ),
                                    Text(
                                      '2024-09-12',
                                      style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize12,
                                        color: HexColor.colorCccc,
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                              Container(
                                margin: const EdgeInsets.only(top: 10),
                                alignment: Alignment.centerLeft,
                                child: Text(
                                  '优惠券过期提醒',
                                  style: StylesUtils.customTextStyle(
                                    fontSize: StylesUtils.fontSize12,
                                    color: HexColor.colorCccc,
                                  ),
                                ),
                              )
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ),
            DrawUnderLine(
              child: Padding(
                padding: const EdgeInsets.only(right: 20),
                child: SizedBox(
                  height: 66,
                  child: Row(
                    children: [
                      CircleAvatar(
                        radius: 24,
                        backgroundColor: HexColor('#1E9FF2'),
                        child: const Icon(
                          CupertinoIcons.bubble_left_bubble_right_fill,
                          size: 25,
                          color: Colors.white,
                        ),
                      ),
                      Expanded(
                        child: Padding(
                          padding: const EdgeInsets.only(left: 15),
                          child: Column(
                            children: [
                              Container(
                                margin: const EdgeInsets.only(top: 15),
                                alignment: Alignment.centerLeft,
                                child: Row(
                                  mainAxisAlignment:
                                      MainAxisAlignment.spaceBetween,
                                  children: [
                                    Text(
                                      '客服',
                                      style: StylesUtils.customTextStyle(
                                        color: HexColor.color3333,
                                        fontWeight: FontWeight.w700,
                                      ),
                                    ),
                                    Text(
                                      '2024-09-19',
                                      style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize12,
                                        color: HexColor.colorCccc,
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                              Container(
                                margin: const EdgeInsets.only(top: 10),
                                alignment: Alignment.centerLeft,
                                child: Row(
                                  mainAxisAlignment:
                                      MainAxisAlignment.spaceBetween,
                                  children: [
                                    Text(
                                      '还有什么可以帮您的吗？',
                                      style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize12,
                                        color: HexColor.colorCccc,
                                      ),
                                    ),
                                    Badge.count(
                                      count: 1,
                                      smallSize: 8,
                                      alignment: Alignment.center,
                                      backgroundColor:
                                          HexColor(HexColor.colorFf62),
                                    )
                                  ],
                                ),
                              )
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ).onTap(() {
              Get.toNamed(Routes.customerChat);
            }),
          ],
        ),
      ),
    );
  }
}
